<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>1.localStorage</title>
  </head>
  <body>
    <button onclick="saveData()">存入数据</button>
    <button onclick="readData()">读取数据</button>
    <button onclick="deleteData()">删除数据</button>
    <button onclick="clearData()">清空数据</button>

    <script type="text/javascript" >
      function saveData(){
        localStorage.setItem('person',JSON.stringify({name:'强geigei',age:18}))
      }
      function readData(){
        let result = localStorage.getItem('person')
        console.log(JSON.parse(result))
      }
      function deleteData(){
        localStorage.removeItem('person')
      }
      function clearData(){
        localStorage.clear()
      }
    </script>
  </body>
</html>